/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.ipo.mm.ejb.facade.city;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.ipo.mm.ejb.entities.City;

/**
 *
 * @author makcro
 */
@Stateless
public class CityFacade implements CityFacadeLocal, CityFacadeRemote {
    @PersistenceContext
    private EntityManager em;

    public void create(City city) {
        em.persist(city);
    }

    public void edit(City city) {
        em.merge(city);
    }

    public void remove(City city) {
        em.remove(em.merge(city));
    }

    public City find(Object id) {
        return em.find(City.class, id);
    }

    public List<City> findAll() {
        return em.createNamedQuery("City.findAll").getResultList();
    }

}
